package org.fast.cms.controller.admin.user;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.fast.cms.common.domain.request.group.Insert;
import org.fast.cms.common.domain.response.JsonResponse;
import org.fast.cms.controller.common.AbstractSysUserController;
import org.fast.cms.domain.admin.request.user.UserBean;
import org.fast.cms.domain.admin.request.user.UserQueryBean;
import org.fast.cms.domain.admin.response.user.UserResponseBean;
import org.fast.cms.service.admin.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/** 
* JSON响应
* @author weigen.ye 
* @date 创建时间：2017年7月14日 上午8:26:23 
*/
@RestController
@RequestMapping(value="/admin/user")
public class SysUserJsonController extends AbstractSysUserController{

	@Autowired
	private SysUserService userService;
	
	/**
	 * 新增用户
	 * @return
	 */
	@RequiresPermissions("user:add")
	@RequestMapping(value="/add", method=RequestMethod.POST)
	public JsonResponse<Void> addUser(@Validated({Insert.class}) UserBean user) {
		//TODO
		return success();
	}
	
	@RequestMapping(value="/list", method=RequestMethod.GET)
	public JsonResponse<UserResponseBean> list(@Validated UserQueryBean user) {
		return success(userService.queryList(user));
	}
}
